import 'package:aichat_flutter_wallet/module/module_browser/provider/browser_proviser.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:lib_util/common/extentions.dart';
import 'package:lib_util/lib_util.dart';

class BrowserFail extends StatelessWidget {
  Function callBack = () {};

  BrowserFail({super.key, required this.callBack});

  @override
  Widget build(BuildContext context) {
    return Consumer<BrowserProvider>(builder: (context, browser, child) {
      return Center(
        child: Column(
          children: [
            SizedBox(
              height: 51.w,
            ),
            Image(
              image: AssetImage('assets/images/dapp/browser_empty.png'),
              height: 180.w,
              width: 180.w,
            ),
            SizedBox(
              height: 10.w,
            ),
            Text('loading fail'),
            SizedBox(
              height: 10.w,
            ),
            GestureDetector(
              onTap: () {
                browser.reload();
                callBack();
              },
              child: Container(
                padding: EdgeInsets.only(left: 15.w, top: 12.w, right: 15.w, bottom: 12.w),
                child: Text(
                  'Click to reload',
                  style: TextStyle(color: '#1D0061'.toColor(), fontSize: 10.sp),
                ),
                decoration: BoxDecoration(color: '#F6F3FF'.toColor(), borderRadius: BorderRadius.circular(10.w)),
              ),
            ),
          ],
        ),
      );
    });
  }
}
